<!-- 处理底部 -->

<template>
  <div>
    <BtnPrimary v-if="isAudit" :title="MAP.audit" @click="openAudit(one)" />

    <BtnPrimary v-if="MAP.hasFinish && isFinish" :title="MAP.finish" @click="openFinish(one)" />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'OurFooter',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb(), CORE.mixWeb('deal', 'deal_')],

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 是否为审批
     */
    isAudit() {
      return this.one.changeStatus === 1
    },

    /**
     * 是否为完成
     */
    isFinish() {
      return this.one.changeStatus === 3
    },
  },

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 打开审批弹窗
     */
    openAudit(one) {
      this.deal_openEdit({
        changeId: one.id,
        changeStatus: one.changeStatus,
        method: 'audit',
        TIP: this.MAP.audit,
        approvalResult: 1,
      })
    },

    /**
     * 打开完成弹窗
     */
    openFinish(one) {
      this.deal_openEdit({
        changeId: one.id,
        changeStatus: one.changeStatus,
        method: 'finish',
        TIP: this.MAP.finish,
      })
    },
  },
}
</script>
